]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceSwitcherPopup: Drop direction parameter
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 26 Jan 2022 00:26:44 +0000 (01:26 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sat, 12 Feb 2022 15:28:52 +0000 (15:28 +0000)
The original popup included arrows that indicated the direction of
the switch. We stopped doing that a long time ago, and ever since
the popup has only indicated active vs. non-active workspaces.

Simplify both the API and style to reflect that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2127>

data/theme/gnome-shell-sass/widgets/_workspace-switcher.scss
js/ui/windowManager.js
js/ui/workspaceSwitcherPopup.js

index 69cf4148bc1b2db3dc7583f177b30a3f684e559b..3edacda5b4ccb6fe24eeafc5ef6890b70c8b6424 100644 (file)
@@ -21,22 +21,18 @@ $ws_border_radius: $modal_radius + 8px;
   spacing: $base_spacing * 2;
 }
 
-.ws-switcher-box {
+.ws-switcher-indicator {
   background: transparent;
   height: 50px;
   background-size: 32px;
   border: 1px solid transparentize($osd_fg_color,0.9);
   border-radius: $base_border_radius + 3px;
-}
 
-// active workspace in the switcher
-.ws-switcher-active-up,
-.ws-switcher-active-down,
-.ws-switcher-active-left,
-.ws-switcher-active-right {
-  height: 52px;
-  background-color: $selected_bg_color;
-  border: 1px solid if($variant=='light', darken($selected_bg_color, 8%), lighten($selected_bg_color, 5%));
-  border-radius: $base_border_radius + 3px;
-  color: $selected_fg_color;
+  &:active {
+    height: 52px;
+    background-color: $selected_bg_color;
+    border: 1px solid if($variant=='light', darken($selected_bg_color, 8%), lighten($selected_bg_color, 5%));
+    border-radius: $base_border_radius + 3px;
+    color: $selected_fg_color;
+  }
 }
index 64f6d734a7807206bdab32339265d2cd2ca87398..a4bbf75ad543eef49fa4f750f79f5ee8a46bc83e 100644 (file)
@@ -1820,7 +1820,7 @@ var WindowManager = class {
                     this._isWorkspacePrepended = false;
                 });
             }
-            this._workspaceSwitcherPopup.display(direction, newWs.index());
+            this._workspaceSwitcherPopup.display(newWs.index());
         }
     }
 
index 5b65bec8ad9922dd713921095ec69ad30827b014..c70b6f7bf76392716e2730d3cb97274caedcbffb 100644 (file)
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported WorkspaceSwitcherPopup */
 
-const { Clutter, GLib, GObject, Meta, St } = imports.gi;
+const { Clutter, GLib, GObject, St } = imports.gi;
 
 const Main = imports.ui.main;
 
@@ -158,18 +158,12 @@ class WorkspaceSwitcherPopup extends St.Widget {
         this._list.destroy_all_children();
 
         for (let i = 0; i < workspaceManager.n_workspaces; i++) {
-            let indicator = null;
-
-            if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.UP)
-                indicator = new St.Bin({ style_class: 'ws-switcher-active-up' });
-            else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.DOWN)
-                indicator = new St.Bin({ style_class: 'ws-switcher-active-down' });
-            else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.LEFT)
-                indicator = new St.Bin({ style_class: 'ws-switcher-active-left' });
-            else if (i == this._activeWorkspaceIndex && this._direction == Meta.MotionDirection.RIGHT)
-                indicator = new St.Bin({ style_class: 'ws-switcher-active-right' });
-            else
-                indicator = new St.Bin({ style_class: 'ws-switcher-box' });
+            const indicator = new St.Bin({
+                style_class: 'ws-switcher-indicator',
+            });
+
+            if (i === this._activeWorkspaceIndex)
+                indicator.add_style_pseudo_class('active');
 
             this._list.add_actor(indicator);
         }
@@ -190,8 +184,7 @@ class WorkspaceSwitcherPopup extends St.Widget {
         this.show();
     }
 
-    display(direction, activeWorkspaceIndex) {
-        this._direction = direction;
+    display(activeWorkspaceIndex) {
         this._activeWorkspaceIndex = activeWorkspaceIndex;
 
         this._redisplay();